package com.zhanglehua.study.awt.event;

import java.awt.AWTEvent;
import java.awt.Button;
import java.awt.HeadlessException;
import java.awt.event.MouseEvent;

public class MyButton extends Button {
	private static final long serialVersionUID = 796244254542507255L;
	
	private MyButton friend = null;

	public MyButton(String title) throws HeadlessException {
		super(title);
		enableEvents(AWTEvent.MOUSE_MOTION_EVENT_MASK);
	}

	@Override
	public void processMouseMotionEvent(MouseEvent e) {
		setVisible(false);
		friend.setVisible(true);
	}
	
	public void setFriend(MyButton friend) {
		this.friend = friend;
	}
}
